1. Field of the Invention
The present invention is generally related to the field of caching, and, more specifically, to systems and methods for updating a cache.
2. Discussion of the Background
A cache is a data storage medium that is used by software (e.g., a computer program) to store recently accessed data that was retrieved from a relatively slower storage medium. The purpose of a cache is to speed up subsequent access to the data. A cache is most often applied to processor-memory access but is also used for storing locally a copy of data accessible over a network.
For example, in a client-server environment where data is centrally stored and managed on a central server (i.e., main storage unit) and software requiring that data runs on a client, a cache for storing the data is created on the client so that the software need not always request the data from the server: the software can request the data from the cache. By having the ability to retrieve the data from the cache as opposed to retrieving it from the server, the software is able to more quickly access the data.
However, in order for the software to function properly, the cache must be periodically updated to ensure that the cache stores the most up to date data. That is, for example, it is desirable to avoid the situation where the cache stores a much earlier version of a file than is stored in the main storage unit.
In the client server environment where there are many clients and each client has its own cache, a network overload problem can occur if several or more of the caches are updated at about the same time. This situation typically occurs when the software that updates the cache is programmed to do so shortly after the software is launched.
The invention aims to overcome the above identified network congestion problem.
In one aspect, the invention provides a method that includes the acts of storing data in a cache, retrieving data from the cache, generating a random number, and updating the cache after an amount of time has elapsed, wherein the amount of time is a function of the generated random number. With this method, caches will be updated at a random point in time, thereby making it unlikely that several caches will be updated at the same time.
In another aspect, the invention provides a system that includes a server and two or more clients. Each client has software (also referred to as xe2x80x9ca programxe2x80x9d) that runs on the client, and, in one embodiment, the programs are launched substantially simultaneously. The programs require data that is stored at the server. Advantageously, each program maintains a cache for storing the required data after the data is retrieved by the program from the server. Once the required data is in the caches, the programs need not retrieve the required data from the server; the programs can retrieve the required data from the program""s cache. To ensure that the data that is stored in the cache does not become stale and to avoid network overload, each program updates its cache at a random point in time.
In another aspect, the invention provides a computer program product for updating a cache. The computer program product is embodied in a computer readable medium and includes computer instructions for: determining whether the cache should be updated immediately; retrieving data from a main storage unit and storing the retrieved data in the cache if it is determined that the cache should be updated immediately; and generating a random number and updating the cache after an amount of time has elapsed, wherein the amount of time is a function of the generated random number, if it is determined that the cache should not be updated immediately.
In another aspect, the invention provides a method for launching applications for a user of a workstation. This method includes the act of: determining a user identifier that identifies the user; transmitting to a database server the user identifier, wherein the database server retrieves from a database application data that is associated with an application that is associated with the user identifier; receiving from the database server the application data; storing the application data in a cache stored on a storage medium to which the workstation has direct access; generating a random number; and updating the cache after an amount of time has elapsed, wherein the amount of time is a function of the generated random number.
The above and other features and advantages of the present invention, as well as the structure and operation of various embodiments of the present invention, are described in detail below with reference to the accompanying drawings.